<?php
/*
 * General Functions
 * 
 * Mainly used functions
 * 
 * @author : Jason Meulenhoff
 * @mail : mail@kacangboi.com
 * @web : http://kacangboi.com
 * @copyright : KacangNetworks 2010
 * 
 */

function isBreadCrumbSessionSet()
{
	if(BREADCRUMB && isset($_SESSION['BREADCRUMB']))
		return true;
	elseif(BREADCRUMB)
		$_SESSION['BREADCRUMB'] = array();
	else
		return false;
}

function addToList($item)
{
	if(sizeof($_SESSION['BREADCRUMB']) >= 3)
	{
			$_SESSION['BREADCRUMB'][0] = $_SESSION['BREADCRUMB'][1];
			$_SESSION['BREADCRUMB'][1] = $_SESSION['BREADCRUMB'][2];
			$_SESSION['BREADCRUMB'][2] = $item;
	}
	else
	{
		array_push($_SESSION['BREADCRUMB'],$item);
	}
}
function getCurrentPage()
{
	$temp = (explode("/",$_SERVER['SCRIPT_NAME']));
	$temp = explode(".",$temp[6]);
	switch($temp[0])
	{
		case "index" :
			return '<a href=\''.$_SERVER['SCRIPT_NAME'].'\'>Loginpage</a>';	
		break;
		case "home" :
			return '<a href=\''.$_SERVER['SCRIPT_NAME'].'\'>Homepage</a>';	
		break;
		case "admin" :
			return '<a href=\''.$_SERVER['SCRIPT_NAME'].'\'>Admin Panel</a>';	
		break;
		case "view" :
			return '<a href=\''.$_SERVER['SCRIPT_NAME'].'\'>Watch Video On Demand</a>';	
		break;
		case "video" :
			return '<a href=\''.$_SERVER['SCRIPT_NAME'].'\'>Video On Demand</a>';	
		break;
		case "both_dutch" :
			return '<a href=\''.$_SERVER['SCRIPT_NAME'].'\'>Live Webcast</a>';	
		break;
		case "both_english" :
			return '<a href=\''.$_SERVER['SCRIPT_NAME'].'\'>Live Webcast</a>';	
		break;
		case "live" :
			return '<a href=\''.$_SERVER['SCRIPT_NAME'].'\'>Live Webcast</a>';	
		break;
		default : 
			return $temp[0];
		break;
	}
}

function displayBreadCrumb()
{
	$display = null;
	for($i=0; $i< sizeof($_SESSION['BREADCRUMB']); $i++)
	{
		$display .= $_SESSION['BREADCRUMB'][$i] . " ".SEPERATOR." ";
	}
	return $display;	
}
?>